package cn.chuanw.db.service;

import cn.chuanw.db.dao.WRentpayRecordMapper;
import cn.chuanw.db.domain.WRentpayRecord;
import cn.chuanw.db.domain.WRentpayRecordExample;
import com.github.pagehelper.PageHelper;


import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;
import java.util.List;

@Service
public class WRentpayRecordService {
    @Resource
    private WRentpayRecordMapper wRentpayRecordMapper;
   
    public List<WRentpayRecord> querySelective(String userId, String houseId, Integer page, Integer size) {
    	WRentpayRecordExample wRentpayRecordExample = new WRentpayRecordExample();
    	WRentpayRecordExample.Criteria criteria = wRentpayRecordExample.createCriteria();
        if (!StringUtils.isEmpty(userId)) {
            criteria.andUserIdLike("%" +userId+"%" );
        }
        if (!StringUtils.isEmpty(houseId)) {
            criteria.andHouseIdLike(houseId);
        }
        criteria.andDelFlagEqualTo(0);
        PageHelper.startPage(page, size);
        return wRentpayRecordMapper.selectByExample(wRentpayRecordExample);
    }

    public void addWHouseInfo(WRentpayRecord wRentpayRecord) {
    	wRentpayRecordMapper.insertSelective(wRentpayRecord);
    }

    public int updateById(WRentpayRecord wRentpayRecord) {
        return wRentpayRecordMapper.updateByPrimaryKeySelective(wRentpayRecord);
    }

}
